<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户注册</title>
    <style>a{TEXT-DECORATION:none}</style>
</head>
<body>
<div style="text-align: center">
<h2>注册新账号</h2>
<%
    String errorMsg = (String) request.getAttribute("errorMsg");
    if (errorMsg != null) {
%>
<div style="color:red;"><%=errorMsg%></div>
<% } %>

<form action="register" method="post"autocomplete="off">
    <div style="margin: 10px 0;">
        <label>用户名：</label>
        <input type="text" name="username" autocomplete="new-password"> <!-- 确保name属性正确 -->
    </div>
    <div style="margin: 10px 0;">
        <label>密码：</label>
        <input type="password" name="password" autocomplete="new-password">
    </div>
    <div style="margin: 10px 0;">
        <label>邮箱：</label>
        <input type="email" name="email">
    </div>
    <div>
        <button type="submit">立即注册</button><br>
        <p>已有账号？<a href="login.jsp">立即登录</a></p>
    </div>
</form>
</div>
</body>
</html>